<template>
	<view>
		<loading :is_init="is_init" :show_time="300"></loading>
		<view class="p3 f28  ">

			<mp-html v-if="is_init==true" style="font-size: 28rpx;line-height: 50rpx;" :content="find.content" />
		</view>
	</view>
</template>
<script>
	import mpHtml from '@/components/mp-html/mp-html'
	export default {
		components: {
			mpHtml
		},
		data() {
			return {
				find: {},
				id: 0,
				is_init: false
			}
		},
		onLoad(options) {
			this.id = parseInt(options.id);
			if (!this.id) {
				this.is_init = true;
				uni.showModal({
					title: '提示',
					content: '请在后台选择关联的文章',
					success: function(res) {
						uni.navigateBack()
					}
				});
				return
			}
			this.init();

		},
		methods: {
			preview(src, e) {
				// do something
			},
			navigate(href, e) {
				// do something
			},
			init() {
				let that = this
				let requestParams = {
					id: this.id
				};
				this.Http.post('banmi.php/Article/ArticleView', requestParams).then(ret => {
					this.url = ret.img_url;
					that.is_init = true;
					if (ret.status != 200) {
						uni.showModal({
							title: '提示',
							content: ret.msg,
							success: function(res) {
								uni.navigateBack()
							}
						});
						return
					}

					this.find = ret.data.find;



					uni.setNavigationBarTitle({
						title: this.find.name
					})
				})

			},
		}
	}
</script>

<style>
	img {
		max-width: 100%;
		height: auto;
	}
</style>